{% extends 'blog/base.html' %}
{% block title %}博客帖子{% endblock %}
{% load blog_tags %}
{% block content %}
		<div class="content-body">
			<div class="container">
				<div class="row">
					<main class="col-md-12">
                        {% for post in posts %}
                            <article class="post post-{{ forloop.counter }}">
							<header class="entry-header">
								<h1 class="entry-title">
									<a href="{{ post.get_absolute_url }}">{{ post.title }}</a>
								</h1>
								<div class="entry-meta">
									<span class="post-category"><a href="#">博客类型</a></span>

									<span class="post-date"><a href="#"><time class="entry-date" datetime="2012-11-09T23:15:57+00:00">{{ post.publish}}</time></a></span>

									<span class="post-author"><a href="#">{{ post.author }}</a></span>

									<span class="comments-link"><a href="">4 评论</a></span>

                                    <span class="views-count"><a href="#">{{ post.views }} 阅读</a></span>

								</div>
							</header>
							<div class="entry-content clearfix">
								<p>{{ post.body|markdown|truncatewords:30|safe}}</p>
								<div class="read-more cl-effect-14">
									<a href="{{ post.get_absolute_url }}" class="more-link">继续阅读 <span class="meta-nav">→</span></a>
								</div>
							</div>
						</article>
                        {% endfor %}
                        <div class="read-more ">
                            <nav aria-label="Page navigation">
                            <ul class="pagination">
                                    {#上一页#}
                                     {% if posts.has_previous %}
                                        <li><a href="{% url 'blog:post_full_width' %}?page={{ posts.previous_page_number }}">
                                            <span aria-hidden="true">&laquo;</span></a></li>
                                     {% else %}
                                          <li class="disabled"><a href="javascript:void(0);">
                                              <span aria-hidden="false">&laquo;</span></a></li>
                                     {% endif %}

                                    {# 左边页码#}
                                    {% if left_has_more %}
                                        <li><a href="{% url 'blog:post_full_width' %}?page=1">1</a></li>
                                        <li><a href="javascript:void(0);">...</a></li>
                                    {% endif %}
                                    {% for left_page in left_pages %}
                                        <li><a href="{% url 'blog:post_full_width' %}?page={{ left_page }}">{{ left_page }}</a></li>
                                    {% endfor %}

                                    {# 当前页#}
                                     <li class="active"><a href="{% url 'blog:post_full_width' %}?page={{ current_page }}">{{ current_page }}</a></li>

                                    {# 右边页码 #}
                                    {% for right_page in right_pages %}
                                        <li><a href="{% url 'blog:post_full_width' %}?page={{ right_page }}">{{ right_page }}</a></li>
                                    {% endfor %}
                                    {% if right_has_more %}
                                         <li><a href="javascript:void(0);">...</a></li>
                                        <li><a href="{% url 'blog:post_full_width' %}?page={{ num_pages }}">{{ num_pages }}</a></li>
                                    {% endif %}
                                    {# 下一页 #}
                                    {% if posts.has_next %}
                                        <li><a href="{% url 'blog:post_full_width' %}?page={{ posts.next_page_number }}">
                                            <span aria-hidden="true">&raquo;</span></a></li>
                                     {% else %}
                                          <li class="disabled"><a href="javascript:void(0);">
                                              <span aria-hidden="false">&raquo;</span></a></li>
                                     {% endif %}
                            </ul>
                        </nav>
                        </div>
					</main>
				</div>
			</div>
		</div>
{% endblock %}

